package com.example.controller;

import com.example.entity.Address;
import com.example.entity.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
public class ResponseController {

    @RequestMapping("/hello")
    public Result hello() {
        System.out.println("hello world!");
        return Result.success("hello world!");
    }

    @RequestMapping("/getAddr")
    public Result getAddr() {
        Address address = new Address();
        address.setProvince("河北省");
        address.setCity("石家庄市");
        return Result.success(address);
    }
    @RequestMapping("/listAddr")
    public Result listAddr() {
        ArrayList<Address> list = new ArrayList<>();
        Address address = new Address();
        address.setProvince("河北省");
        address.setCity("石家庄市");

        Address address1 = new Address();
        address1.setProvince("河北省");
        address1.setCity("石家庄市");

        list.add(address);
        list.add(address1);
        return Result.success(list);
    }
}
